package com.surprise.db.dao.join;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.surprise.db.dao.SimpleDAO;
import com.surprise.db.entity.join.SelectPMThingsCommentMst001Entity;

/**
 * SelectPMThingsCommentMst001.java
 * @author xuling
 * @since 2017年2月14日
 */
@Repository
public class SelectPMThingsCommentMst001 extends SimpleDAO<SelectPMThingsCommentMst001Entity> {

	/**
	 * 获得那些事的评论
	 * @param thingsid 那些事ID
	 * @return 那些事的评论
	 */
	public List<SelectPMThingsCommentMst001Entity> select(Long thingsid) {
		String sql = " SELECT pm_things_comment_mst.id, " +
				" pm_things_comment_mst.userid, " +
				" pm_things_comment_mst.thingsid, " +
				" pm_things_comment_mst.img, " +
				" pm_things_comment_mst.content, " +
				" user.username as username, " +
				" user.portrait as portrait FROM pm_things_comment_mst INNER JOIN  " +
				" user on user.id = pm_things_comment_mst.userid " +
				" where pm_things_comment_mst.thingsid = ? ";

		return super.findBySql(sql, thingsid);
	}
}
